{{define "Title"}}增加用户{{end}}
{{define "Content"}}

<script type=text/javascript src="/js/splitPage.js"></script>
<script type=text/javascript src="/js/enterKey.js"></script>
<script type=text/javascript src="/js/users.js"></script>
<script type=text/javascript src="/js/userSplit.js"></script>
<script type=text/javascript src="/js/tablestyle.js"></script>

<div class="container-fluid">
<form class="form-horizontal" action="/adduser" method="POST">
  <fieldset>
    <legend><b>增加用户</b></legend>
    {{if .error}}<div class="alert alert-error"><b>错误: </b>{{.error | html}}</div>
    {{else }}
      {{if .flash}}<div class="alert alert-success"><b>提示: </b>{{.flash | html}}</div>{{end}}
    {{end}}
    <div class="control-group">
      <label class="control-label">用户代码&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="userid" name="userid" style="background-color: #FFFFD0;" onkeydown="clicka();" maxlength="20"> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">用户名称&nbsp;</label>
      <div class="control">
        <input type="text" class="input-large" id="username" name="username" style="background-color:#FFFFD0;" onkeydown="clicka();" maxlength="20"> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">所属部门&nbsp;</label>
      <div class="control">
        <select id="department" name="department" onkeydown="clicka();" onmousewheel="return false">
          <option value="">
          {{range .types}}
            <option value="{{.Typeeng | html}} | {{.Typechn | html}}">{{.Typeeng | html}} | {{.Typechn | html}}
          {{end}}
        </select>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">密码&nbsp;</label>
      <div class="control">
        <input type="password" class="input-large" id="newpassword" name="newpassword" style="background-color:#FFFFD0;" onkeydown="clicka();"> <b style="color: red">*</b>
      </div>
    </div>
    <div class="control-group">
      <label class="control-label">密码重复&nbsp;</label>
      <div class="control">
        <input type="password" class="input-large" id="newpassword2" name="newpassword2" style="background-color:#FFFFD0;" onkeydown="clicka();"> <b style="color: red">*</b>
      </div>
    </div>
    <div class="content-box">
      <div class="content-box-header">
        <p style="font-size: 16px;">&nbsp;&nbsp;<b>权限选择</b></p>
      </div>
      <div class="content-box-content">
        <table id="tbl" width="100%" border="1" cellspacing="0" cellpadding="0">
          <thead>
            <tr>
              <th>用户操作</th>
              <th><input type='checkbox' id='reportchk' value='1' onclick="selectChoose(this, 'rptchk')">数据查询</th>
              <th>工单管理</th>
              <th>系统设置</th>
              <th>用户设置</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td id="ope" fieldset style="width: 200; color: #666666; border-style: groove; font-weight: bold" align="left"></td>
              <td id="rpt" fieldset style="width: 200; color: #666666; border-style: groove; font-weight: bold" align="left"></td>
              <td id="wom" fieldset style="width: 200; color: #666666; border-style: groove; font-weight: bold" align="left"></td>
              <td id="sys" fieldset style="width: 200; color: #666666; border-style: groove; font-weight: bold" align="left"></td>
              <td id="usr" fieldset style="width: 200; color: #666666; border-style: groove; font-weight: bold" align="left"></td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
    <div class="form-actions">
      <button type="submit" class="btn btn-primary">增加用户</button>
    </div>
  </fieldset>
</form>
</div>

{{if .usrs}}
  <div class="content-box">
    <div class="content-box-header">
      <p style="font-size: 16px;">&nbsp;&nbsp;<b>用户明细</b></p>
    </div>
  <div class="content-box-content">
    <span id=obj1 style="color: black">
    <table id="tbl_ls" border="1" cellspacing="0" cellpadding="0">
      <thead>
        <tr>
          <th>索引</th>
          <th>用户代码</th>
          <th>用户名称</th>
          <th>所属部门</th>
          <th>是否过期</th>
          <th>权限</th>
        </tr>
      </thead>
      
      <tbody id="group_one">
      {{range .usrs}}
      {{$curls := .}}
      <tr>
        <td id="detail_idx" fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" align="center" width="80">{{.Index | html}}</td>
        <td id="detail_uid" fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" width="160">{{.Id | html}}</td>
        <td id="detail_nam" fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" width="200">{{.Name | html}}</td>
        <td id="detail_dep" fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" width="200">{{.Department | html}}</td>
        <td id="detail_exp" fieldset style="color: #666666; border-style: groove; font-weight: bold; font-size: 14px" align="center" width="80">{{.Expire | html}}</td>
        <td id="detail_rig" fieldset style="color: #666666; border-style: groove; font-weight: bold" align="center" width="120"><a href="/usrdetail?userid={{.Id | html}}">Rights</a></td>
      </tr>
      {{end}}
      </tbody>
      
    </table>
  </span>
  </div>
</div>

<span id="spanFirst"><img id='first' src="/images/FirstPageImageUrl.gif" onclick="onFirstClick();"/></span> <span id="spanPre"><img id='prev' src="/images/PreviousPageImageUrl.gif" onclick="onPrevClick();"/></span> <span id="spanNext"><img id='next' src="/images/NextPageImageUrl.gif" onclick="onNextClick();"/></span> <span id="spanLast"><img id='last' src="/images/LastPageImageUrl.gif" onclick="onLastClick();"/></span> 当前页: <span id="spanPageNum">{{.curr_page}}</span> / 总页数: <span id="spanTotalPage">{{.total_page}}</span> <span><input id="specialnum" style="width: 60px; color: blue; font-size: 14px; font-weight: bold;" type="text" onkeydown="onSpecialKeydown();"></span><span id="GotoSpecial" style="font-size: 14px; font-weight: bold; cursor:hand; text-decoration:underline; color: #57a000;" onclick="onSpecialClick();">Goto!</span>
<input type=button id="usrquery" value="ff" style="display:none">

{{end}}

<input type=button id="btnuser" value="" style="display:none" onclick="rightsSet({{.rights}});">
<script type="text/javascript">
  btnuser.click();
</script>

{{end}}